<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/all.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.8.0.js"></script>
<script type="text/javascript" src="js/layer.js"></script>
<script type="text/javascript" src="js/layer.min.js"></script>
<script type="text/javascript" src="js/jquery validation.js"></script>
<link rel="stylesheet" href="css/adminreg.css" type="text/css" />
<style type="text/css"></style>
<script type="text/javascript">
	function onProvinceChange(province) {
		var pid = province.value;
		$.ajax({
			type : "POST",
			url : "adminAction!getUniv",
			data : ({
				pid : pid
			}),
			success : function(data) {
				$("#un").html($(data).find("#un").css("border", "0"));
				//$(data).find('body').html();
			}
		});
	}
</script>
<script type="text/javascript">

	function changeImg() {
		$("#authCode").attr("src", "authCode.action?d=" + new Date().valueOf());
	}
</script>
<script type="text/javascript">
$(document).ready(function(){
    $("#signupForm").validate();
});
</script>
<script type="text/javascript">
	function codeChange(code) {
		$.ajax({
			type : "POST",
			url : "adminAction!codeConfirm",
			data : ({
				code : code
			}),
			success : function(data) {
				if (data == 0) {
					alert("亲 验证码错误！请重新输入吧");
				}
				//alert(data);
				//$("#un").html($(data).find("#un").css("border","0"));
				//$(data).find('body').html();
			}
		});
	}
	function emailConfirm(email) {

		$.ajax({
			type : "POST",
			url : "adminAction!emailConfirm",
			data : ({
				email : email
			}),
			success : function(data) {
				if (data == 0) {
					alert("亲 此邮箱已注册！换个邮箱吧");
				}

			}
		});
	}
</script>


</head>
<body>
	<br />
	<br />

	<s:form action="adminAction!addPicture" method="POST"
		enctype="multipart/form-data" name="form" id="signupForm">
		<table align="center">
			<tr>
				<td colspan="3">管理员注册</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>选择省份：</p></td>
				<td><select name="pid" onchange="onProvinceChange(pid);"
					style="width: 100px;">
						<s:iterator value="list" var="provinces">
							<option value=<s:property value="#provinces.id" />>
								<s:property value="#provinces.name" />
							</option>
						</s:iterator>
						<option selected="selected">--请选择所在省--</option>
				</select></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>所在学校：</p></td>
				<td id="un"><select name="uid" style="width: 200px;">
						<s:iterator value="Ulist" var="univs">
							<option value=<s:property value="#univs.id" />>
								<s:property value="#univs.name" />
							</option>
						</s:iterator>
						<option selected="selected">--请选择所在学校--</option>
				</select></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>所在校区：</p></td>
				<td><input type="text" name="ad.school" style="width: 150px;"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>真实姓名：</p></td>
				<td><input type="text" name="ad.name" style="width: 150px;"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>email：</p></td>
				<td><input type="text" name="email" style="width: 150px;"
					onblur="emailConfirm(email.value);" class="required email"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>密码：</p></td>
				<td><input type="password" name="ad.pwd" style="width: 150px;"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>确认密码：</p></td>
				<td><input type="password" name="repwd" style="width: 150px;"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>身份证号码：</p></td>
				<td><input type="text" name="ad.idcard" style="width: 200px;"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>电话：</p></td>
				<td><input type="text" name="ad.phone" style="width: 150px;"></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>图片：</p></td>
				<td><s:file name="picture"  /> <s:fielderror
						fieldName="picture"></s:fielderror></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><p>验证码：</p></td>
				<td>
					<table id="table2">
						<tr>
							<td><img src="authCode.action" alt="验证码" id="authCode"
								onclick="changeImg()"></td>
							<td><input type="text" name="code"
								onblur="codeChange(code.value);"
								style="width: 70px; height: 30px; border-bottom-color: red; border-top-style: none; border-left-style: none;">

							</td>
							<td><p>
									<a href="#" onclick="changeImg()">换一张</a>
								</p></td>

						</tr>
					</table>
				</td>
				<td></td>
			</tr>
			<tr>
				<td colspan="3"><input type="submit" value="提交" onclick=""> <input
					type="reset" value="重置"></td>
				<td></td>
				<td></td>
			</tr>
		</table>
	</s:form>
</body>
</html>